package com.atstudy.headline.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 用户行为日志表
 * @TableName user_behaviors
 */
@TableName(value ="user_behaviors")
@Data
public class UserBehaviors {
    /**
     * 行为ID
     */
    @TableId(type = IdType.AUTO)
    private Integer behaviorId;

    /**
     * 用户ID
     */
    private Integer userId;

    /**
     * 内容ID
     */
    private Integer contentId;

    /**
     * 行为类型编码
     */
    private Integer behaviorCode;

    /**
     * 行为类型（关联base_dicts.dict_type）
     */
    private String behaviorType;

    /**
     * 行为时间
     */
    private Date behaviorTime;

    /**
     * 会话ID
     */
    private String sessionId;

    /**
     * 设备信息
     */
    private Object deviceInfo;

    /**
     * 地理位置
     */
    private Object location;

    /**
     * 停留时长（秒）
     */
    private Integer duration;

    /**
     * 滚动百分比
     */
    private BigDecimal scrollPercentage;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserBehaviors other = (UserBehaviors) that;
        return (this.getBehaviorId() == null ? other.getBehaviorId() == null : this.getBehaviorId().equals(other.getBehaviorId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getContentId() == null ? other.getContentId() == null : this.getContentId().equals(other.getContentId()))
            && (this.getBehaviorCode() == null ? other.getBehaviorCode() == null : this.getBehaviorCode().equals(other.getBehaviorCode()))
            && (this.getBehaviorType() == null ? other.getBehaviorType() == null : this.getBehaviorType().equals(other.getBehaviorType()))
            && (this.getBehaviorTime() == null ? other.getBehaviorTime() == null : this.getBehaviorTime().equals(other.getBehaviorTime()))
            && (this.getSessionId() == null ? other.getSessionId() == null : this.getSessionId().equals(other.getSessionId()))
            && (this.getDeviceInfo() == null ? other.getDeviceInfo() == null : this.getDeviceInfo().equals(other.getDeviceInfo()))
            && (this.getLocation() == null ? other.getLocation() == null : this.getLocation().equals(other.getLocation()))
            && (this.getDuration() == null ? other.getDuration() == null : this.getDuration().equals(other.getDuration()))
            && (this.getScrollPercentage() == null ? other.getScrollPercentage() == null : this.getScrollPercentage().equals(other.getScrollPercentage()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getBehaviorId() == null) ? 0 : getBehaviorId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getContentId() == null) ? 0 : getContentId().hashCode());
        result = prime * result + ((getBehaviorCode() == null) ? 0 : getBehaviorCode().hashCode());
        result = prime * result + ((getBehaviorType() == null) ? 0 : getBehaviorType().hashCode());
        result = prime * result + ((getBehaviorTime() == null) ? 0 : getBehaviorTime().hashCode());
        result = prime * result + ((getSessionId() == null) ? 0 : getSessionId().hashCode());
        result = prime * result + ((getDeviceInfo() == null) ? 0 : getDeviceInfo().hashCode());
        result = prime * result + ((getLocation() == null) ? 0 : getLocation().hashCode());
        result = prime * result + ((getDuration() == null) ? 0 : getDuration().hashCode());
        result = prime * result + ((getScrollPercentage() == null) ? 0 : getScrollPercentage().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", behaviorId=").append(behaviorId);
        sb.append(", userId=").append(userId);
        sb.append(", contentId=").append(contentId);
        sb.append(", behaviorCode=").append(behaviorCode);
        sb.append(", behaviorType=").append(behaviorType);
        sb.append(", behaviorTime=").append(behaviorTime);
        sb.append(", sessionId=").append(sessionId);
        sb.append(", deviceInfo=").append(deviceInfo);
        sb.append(", location=").append(location);
        sb.append(", duration=").append(duration);
        sb.append(", scrollPercentage=").append(scrollPercentage);
        sb.append("]");
        return sb.toString();
    }
}